﻿using System;

namespace IntelligentLevelEditor.Games.DenpaMen
{
    public static class Crypt
    {
        #region HighNibbleTable
        private static readonly byte[][] HighNibbleTable = new [] {
            new byte[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, //0x00
            new byte[] {0x0,0xF,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, 
            new byte[] {0xF,0xF,0xF,0xF,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, 
            new byte[] {0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0x0,0x0,0x0,0xF,0x0,0x0,0x0,0x0},
            new byte[] {0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF},
            new byte[] {0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xF,0xF,0xF,0xF,0xF,0xE,0xF,0xF},
            new byte[] {0xE,0xE,0xE,0xE,0xD,0xD,0xD,0xD,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE},
            new byte[] {0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xC,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD},
            new byte[] {0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC}, //0x08
            new byte[] {0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xA,0xB,0xB,0xB,0xB,0xB,0xB},
            new byte[] {0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0x9,0x9,0x9,0x9,0xA,0xA,0xA,0xA},
            new byte[] {0x9,0x9,0x9,0x8,0x9,0x9,0x9,0x9,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8},
            new byte[] {0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7},
            new byte[] {0x6,0x6,0x6,0x6,0x6,0x5,0x6,0x6,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5},
            new byte[] {0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x3,0x3,0x3,0x3},
            new byte[] {0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x1},
            new byte[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, //0x10
            new byte[] {0xE,0xF,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,
                        0xF,0xC,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF},
            new byte[] {0xD,0xD,0xD,0xD,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,
                        0xA,0xA,0xA,0xA,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD},
            new byte[] {0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xA,0xA,0xA,0xB,0xA,0xA,0xA,0xA,
                        0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0xB,0xB,0xB,0x8,0xB,0xB,0xB,0xB},
            new byte[] {0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,
                        0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6},
            new byte[] {0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x7,0x7,0x7,0x7,0x7,0x4,0x7,0x7,
                        0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x4,0x4,0x4,0x4,0x4,0x5,0x4,0x4},
            new byte[] {0x2,0x2,0x2,0x2,0x3,0x3,0x3,0x3,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,
                        0x3,0x3,0x3,0x3,0x0,0x0,0x0,0x0,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3},
            new byte[] {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0xE,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,
                        0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xF,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE},
            new byte[] {0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC}, //0x18
            new byte[] {0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0x8,0xB,0xB,0xB,0xB,0xB,0xB,
                        0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x9,0x8,0x8,0x8,0x8,0x8,0x8},
            new byte[] {0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x7,0x7,0x7,0x7,0x6,0x6,0x6,0x6,
                        0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x4,0x4,0x4,0x4,0x7,0x7,0x7,0x7},
            new byte[] {0x5,0x5,0x5,0x2,0x5,0x5,0x5,0x5,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,
                        0x2,0x2,0x2,0x3,0x2,0x2,0x2,0x2,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3},
            new byte[] {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,
                        0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE},
            new byte[] {0xC,0xC,0xC,0xC,0xC,0xD,0xC,0xC,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,
                        0xD,0xD,0xD,0xD,0xD,0xA,0xD,0xD,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA},
            new byte[] {0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x9,0x9,0x9,0x9,
                        0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x6,0x6,0x6,0x6},
            new byte[] {0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x5,
                        0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x2},
            new byte[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, //0x20
            new byte[] {0xC,0xF,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,
                        0xD,0xC,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,
                        0xE,0x9,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,
                        0xF,0xE,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF},
            new byte[] {0xB,0xB,0xB,0xB,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,
                        0x8,0x8,0x8,0x8,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,
                        0x5,0x5,0x5,0x5,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,
                        0xA,0xA,0xA,0xA,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB},
            new byte[] {0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x4,0x4,0x4,0x7,0x4,0x4,0x4,0x4,
                        0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x5,0x5,0x5,0x4,0x5,0x5,0x5,0x5,
                        0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x6,0x6,0x6,0x1,0x6,0x6,0x6,0x6,
                        0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x7,0x7,0x7,0x6,0x7,0x7,0x7,0x7},
            new byte[] {0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,
                        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
                        0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,
                        0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2},
            new byte[] {0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xF,0xF,0xF,0xF,0xF,0xE,0xF,0xF,
                        0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xC,0xC,0xC,0xC,0xC,0xF,0xC,0xC,
                        0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x9,0x9,0x9,0x9,0x9,0x8,0x9,0x9,
                        0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0xE,0xE,0xE,0xE,0xE,0x9,0xE,0xE},
            new byte[] {0xA,0xA,0xA,0xA,0x5,0x5,0x5,0x5,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,
                        0xB,0xB,0xB,0xB,0xA,0xA,0xA,0xA,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,
                        0x4,0x4,0x4,0x4,0x7,0x7,0x7,0x7,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,
                        0x5,0x5,0x5,0x5,0x4,0x4,0x4,0x4,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5},
            new byte[] {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,
                        0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x1,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,
                        0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x2,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,
                        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
            new byte[] {0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC}, //0x28
            new byte[] {0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xA,0xB,0xB,0xB,0xB,0xB,0xB,
                        0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0xB,0x8,0x8,0x8,0x8,0x8,0x8,
                        0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x4,0x5,0x5,0x5,0x5,0x5,0x5,
                        0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0x5,0xA,0xA,0xA,0xA,0xA,0xA},
            new byte[] {0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x1,0x1,0x1,0x1,0x6,0x6,0x6,0x6,
                        0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x6,0x6,0x6,0x6,0x7,0x7,0x7,0x7,
                        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x3,0x3,0x3,0x0,0x0,0x0,0x0,
                        0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0,0x0,0x0,0x1,0x1,0x1,0x1},
            new byte[] {0xD,0xD,0xD,0xC,0xD,0xD,0xD,0xD,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,
                        0x2,0x2,0x2,0xD,0x2,0x2,0x2,0x2,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,
                        0xF,0xF,0xF,0xE,0xF,0xF,0xF,0xF,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,
                        0xC,0xC,0xC,0xF,0xC,0xC,0xC,0xC,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF},
            new byte[] {0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,
                        0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,
                        0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,
                        0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA},
            new byte[] {0x6,0x6,0x6,0x6,0x6,0x1,0x6,0x6,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,
                        0x7,0x7,0x7,0x7,0x7,0x6,0x7,0x7,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,
                        0x0,0x0,0x0,0x0,0x0,0x3,0x0,0x0,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,
                        0x1,0x1,0x1,0x1,0x1,0x0,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
            new byte[] {0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xF,0xF,0xF,0xF,
                        0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xC,0xC,0xC,0xC,
                        0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0x9,0x9,0x9,0x9,
                        0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xE,0xE,0xE,0xE},
            new byte[] {0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0x5,
                        0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xA,
                        0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x7,
                        0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x4},
            new byte[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, //0x30
            new byte[] {0xE,0xF,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,
                        0xF,0x8,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,
                        0x8,0x9,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,
                        0x9,0xA,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9},
            new byte[] {0x5,0x5,0x5,0x5,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,
                        0x6,0x6,0x6,0x6,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,
                        0x7,0x7,0x7,0x7,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,
                        0x0,0x0,0x0,0x0,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7},
            new byte[] {0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x2,0x2,0x2,0x3,0x2,0x2,0x2,0x2,
                        0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0x3,0x3,0x3,0xC,0x3,0x3,0x3,0x3,
                        0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xC,0xC,0xC,0xD,0xC,0xC,0xC,0xC,
                        0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xD,0xD,0xD,0xE,0xD,0xD,0xD,0xD},
            new byte[] {0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,
                        0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,
                        0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,
                        0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4},
            new byte[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0x7,0x7,0x7,0x7,0x0,0x7,0x7,
                        0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,
                        0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x1,0x1,0x1,0x1,0x1,0x2,0x1,0x1,
                        0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x2,0x2,0x2,0x2,0x2,0x3,0x2,0x2},
            new byte[] {0xE,0xE,0xE,0xE,0xF,0xF,0xF,0xF,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,
                        0xF,0xF,0xF,0xF,0x8,0x8,0x8,0x8,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,
                        0x8,0x8,0x8,0x8,0x9,0x9,0x9,0x9,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,
                        0x9,0x9,0x9,0x9,0xA,0xA,0xA,0xA,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9},
            new byte[] {0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x6,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,
                        0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x7,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,
                        0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x0,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,
                        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
            new byte[] {0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC}, //0x38
            new byte[] {0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0x4,0xB,0xB,0xB,0xB,0xB,0xB,
                        0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x5,0x4,0x4,0x4,0x4,0x4,0x4,
                        0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x6,0x5,0x5,0x5,0x5,0x5,0x5,
                        0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x7,0x6,0x6,0x6,0x6,0x6,0x6},
            new byte[] {0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x3,0x3,0x3,0x3,0x2,0x2,0x2,0x2,
                        0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0xC,0xC,0xC,0xC,0x3,0x3,0x3,0x3,
                        0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xD,0xD,0xD,0xD,0xC,0xC,0xC,0xC,
                        0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xE,0xE,0xE,0xE,0xD,0xD,0xD,0xD},
            new byte[] {0x9,0x9,0x9,0xA,0x9,0x9,0x9,0x9,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,
                        0xA,0xA,0xA,0xB,0xA,0xA,0xA,0xA,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,
                        0xB,0xB,0xB,0x4,0xB,0xB,0xB,0xB,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,
                        0x4,0x4,0x4,0x5,0x4,0x4,0x4,0x4,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5},
            new byte[] {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,
                        0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,
                        0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,
                        0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC},
            new byte[] {0x8,0x8,0x8,0x8,0x8,0x9,0x8,0x8,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,
                        0x9,0x9,0x9,0x9,0x9,0xA,0x9,0x9,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,
                        0xA,0xA,0xA,0xA,0xA,0xB,0xA,0xA,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,
                        0xB,0xB,0xB,0xB,0xB,0x4,0xB,0xB,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4},
            new byte[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x1,0x1,
                        0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x2,0x2,0x2,0x2,
                        0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x3,0x3,0x3,0x3,
                        0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0xC,0xC,0xC,0xC},
            new byte[] {0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x9,
                        0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0xA,
                        0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xB,
                        0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0x4},
            new byte[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, //0x40
            new byte[] {0x8,0xF,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,
                        0x9,0x8,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,
                        0xA,0x9,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,
                        0xB,0xA,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB},
            new byte[] {0x7,0x7,0x7,0x7,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
                        0x0,0x0,0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,
                        0x1,0x1,0x1,0x1,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,
                        0x2,0x2,0x2,0x2,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3},
            new byte[] {0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0x8,0x8,0x8,0xF,0x8,0x8,0x8,0x8,
                        0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x9,0x9,0x9,0x8,0x9,0x9,0x9,0x9,
                        0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0xA,0xA,0xA,0x9,0xA,0xA,0xA,0xA,
                        0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xB,0xB,0xB,0xA,0xB,0xB,0xB,0xB},
            new byte[] {0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,
                        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
                        0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,
                        0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2},
            new byte[] {0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xF,0xF,0xF,0xF,0xF,0xE,0xF,0xF,
                        0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0x8,0x8,0x8,0x8,0x8,0xF,0x8,0x8,
                        0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x9,0x9,0x9,0x9,0x9,0x8,0x9,0x9,
                        0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0xA,0xA,0xA,0xA,0xA,0x9,0xA,0xA},
            new byte[] {0x6,0x6,0x6,0x6,0x5,0x5,0x5,0x5,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,
                        0x7,0x7,0x7,0x7,0x6,0x6,0x6,0x6,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,
                        0x0,0x0,0x0,0x0,0x7,0x7,0x7,0x7,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
                        0x1,0x1,0x1,0x1,0x0,0x0,0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1},
            new byte[] {0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xC,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,
                        0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xD,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,
                        0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xE,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,
                        0x8,0x8,0x8,0x8,0x8,0x8,0x8,0xF,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8},
            new byte[] {0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4}, //0x48
            new byte[] {0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x2,0x3,0x3,0x3,0x3,0x3,0x3,
                        0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0x3,0xC,0xC,0xC,0xC,0xC,0xC,
                        0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xC,0xD,0xD,0xD,0xD,0xD,0xD,
                        0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xD,0xE,0xE,0xE,0xE,0xE,0xE},
            new byte[] {0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0x9,0x9,0x9,0x9,0xA,0xA,0xA,0xA,
                        0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xA,0xA,0xA,0xA,0xB,0xB,0xB,0xB,
                        0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0xB,0xB,0xB,0xB,0x4,0x4,0x4,0x4,
                        0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x4,0x4,0x4,0x4,0x5,0x5,0x5,0x5},
            new byte[] {0x1,0x1,0x1,0x0,0x1,0x1,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
                        0x2,0x2,0x2,0x1,0x2,0x2,0x2,0x2,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,
                        0x3,0x3,0x3,0x2,0x3,0x3,0x3,0x3,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,
                        0xC,0xC,0xC,0x3,0xC,0xC,0xC,0xC,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3},
            new byte[] {0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,
                        0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,
                        0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,
                        0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA},
            new byte[] {0x6,0x6,0x6,0x6,0x6,0x5,0x6,0x6,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,
                        0x7,0x7,0x7,0x7,0x7,0x6,0x7,0x7,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,
                        0x0,0x0,0x0,0x0,0x0,0x7,0x0,0x0,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,
                        0x1,0x1,0x1,0x1,0x1,0x0,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
            new byte[] {0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0x3,0x3,0x3,0x3,
                        0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xC,0xC,0xC,0xC,
                        0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xD,0xD,0xD,0xD,
                        0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xE,0xE,0xE,0xE},
            new byte[] {0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0x9,
                        0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xA,
                        0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0xB,
                        0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x4},
            new byte[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, //0x50
            new byte[] {0xE,0xF,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,
                        0xF,0xC,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,
                        0x8,0x9,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,
                        0x9,0xE,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9},
            new byte[] {0x5,0x5,0x5,0x5,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,
                        0xA,0xA,0xA,0xA,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,
                        0x7,0x7,0x7,0x7,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,
                        0x4,0x4,0x4,0x4,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7},
            new byte[] {0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x2,0x2,0x2,0x3,0x2,0x2,0x2,0x2,
                        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x3,0x3,0x0,0x3,0x3,0x3,0x3,
                        0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xC,0xC,0xC,0xD,0xC,0xC,0xC,0xC,
                        0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0xD,0xD,0xD,0x2,0xD,0xD,0xD,0xD},
            new byte[] {0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,
                        0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,
                        0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,
                        0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8},
            new byte[] {0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x7,0x7,0x7,0x7,0x7,0x4,0x7,0x7,
                        0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x4,0x4,0x4,0x4,0x4,0x5,0x4,0x4,
                        0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x1,0x1,0x1,0x1,0x1,0x6,0x1,0x1,
                        0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x6,0x6,0x6,0x6,0x6,0x7,0x6,0x6},
            new byte[] {0x2,0x2,0x2,0x2,0x3,0x3,0x3,0x3,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,
                        0x3,0x3,0x3,0x3,0x0,0x0,0x0,0x0,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,
                        0xC,0xC,0xC,0xC,0xD,0xD,0xD,0xD,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,
                        0xD,0xD,0xD,0xD,0x2,0x2,0x2,0x2,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD},
            new byte[] {0x9,0x9,0x9,0x9,0x9,0x9,0x9,0xE,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,
                        0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xF,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,
                        0xB,0xB,0xB,0xB,0xB,0xB,0xB,0x8,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,
                        0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x9,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8},
            new byte[] {0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4}, //0x58
            new byte[] {0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x0,0x3,0x3,0x3,0x3,0x3,0x3,
                        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,
                        0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0x2,0xD,0xD,0xD,0xD,0xD,0xD,
                        0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x3,0x2,0x2,0x2,0x2,0x2,0x2},
            new byte[] {0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xF,0xF,0xF,0xF,0xE,0xE,0xE,0xE,
                        0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xC,0xC,0xC,0xC,0xF,0xF,0xF,0xF,
                        0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x9,0x9,0x9,0x9,0x8,0x8,0x8,0x8,
                        0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0xE,0xE,0xE,0xE,0x9,0x9,0x9,0x9},
            new byte[] {0x5,0x5,0x5,0xA,0x5,0x5,0x5,0x5,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,
                        0xA,0xA,0xA,0xB,0xA,0xA,0xA,0xA,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,
                        0x7,0x7,0x7,0x4,0x7,0x7,0x7,0x7,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,
                        0x4,0x4,0x4,0x5,0x4,0x4,0x4,0x4,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5},
            new byte[] {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,
                        0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,
                        0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,
                        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
            new byte[] {0xC,0xC,0xC,0xC,0xC,0xD,0xC,0xC,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,
                        0xD,0xD,0xD,0xD,0xD,0x2,0xD,0xD,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,
                        0xE,0xE,0xE,0xE,0xE,0xF,0xE,0xE,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,
                        0xF,0xF,0xF,0xF,0xF,0xC,0xF,0xF,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC},
            new byte[] {0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x9,0x9,0x9,0x9,
                        0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0xE,0xE,0xE,0xE,
                        0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xB,0xB,0xB,0xB,
                        0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0x8,0x8,0x8,0x8},
            new byte[] {0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x5,
                        0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0xA,
                        0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x7,
                        0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x4},
            new byte[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, //0x60
            new byte[] {0xC,0xF,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,
                        0xD,0xC,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD},
            new byte[] {0xB,0xB,0xB,0xB,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,
                        0x8,0x8,0x8,0x8,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9},
            new byte[] {0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x4,0x4,0x4,0x7,0x4,0x4,0x4,0x4,
                        0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x5,0x5,0x5,0x4,0x5,0x5,0x5,0x5},
            new byte[] {0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,
                        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
            new byte[] {0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xF,0xF,0xF,0xF,0xF,0xE,0xF,0xF,
                        0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xC,0xC,0xC,0xC,0xC,0xF,0xC,0xC},
            new byte[] {0xA,0xA,0xA,0xA,0xD,0xD,0xD,0xD,0xA,0xA,0xA,0xA,0xA,0xA,0xA,0xA,
                        0xB,0xB,0xB,0xB,0xA,0xA,0xA,0xA,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB},
            new byte[] {0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x8,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,
                        0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x9,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6},
            new byte[] {0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4}, //0x68
            new byte[] {0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x2,0x3,0x3,0x3,0x3,0x3,0x3,
                        0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x0,0x0,0x0,0x0,0x0,0x0},
            new byte[] {0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0x1,0x1,0x1,0x1,0xE,0xE,0xE,0xE,
                        0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xE,0xE,0xE,0xE,0xF,0xF,0xF,0xF},
            new byte[] {0xD,0xD,0xD,0xC,0xD,0xD,0xD,0xD,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,
                        0xA,0xA,0xA,0xD,0xA,0xA,0xA,0xA,0xD,0xD,0xD,0xD,0xD,0xD,0xD,0xD},
            new byte[] {0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,
                        0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8},
            new byte[] {0x6,0x6,0x6,0x6,0x6,0x9,0x6,0x6,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,
                        0x7,0x7,0x7,0x7,0x7,0x6,0x7,0x7,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6},
            new byte[] {0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x7,0x7,0x7,0x7,
                        0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x4,0x4,0x4,0x4},
            new byte[] {0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x5,
                        0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x2},
            new byte[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}, //0x70
            new byte[] {0xE,0xF,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE,0xE},
            new byte[] {0xD,0xD,0xD,0xD,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC,0xC},
            new byte[] {0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xB,0xA,0xA,0xA,0xB,0xA,0xA,0xA,0xA},
            new byte[] {0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9,0x9},
            new byte[] {0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x7,0x7,0x7,0x7,0x7,0x8,0x7,0x7},
            new byte[] {0x6,0x6,0x6,0x6,0x7,0x7,0x7,0x7,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6},
            new byte[] {0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x6,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5},
            new byte[] {0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4}, //0x78
            new byte[] {0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x4,0x3,0x3,0x3,0x3,0x3,0x3},
            new byte[] {0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x3,0x3,0x3,0x3,0x2,0x2,0x2,0x2},
            new byte[] {0x1,0x1,0x1,0x2,0x1,0x1,0x1,0x1,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2},
            new byte[] {0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1},
            new byte[] {0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1},
            new byte[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x1,0x1},
            new byte[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1} //0x7F
        };

        #endregion

        #region Alphanumerics
        private static readonly byte[][] Alphanumerics = new[]
            {
	        new byte[] { 0x24 , 0x2A }, new byte[] { 0x25 , 0x2A }, new byte[] { 0x2E , 0x46 },
	        new byte[] { 0x2F , 0x46 }, new byte[] { 0x20 , 0x46 }, new byte[] { 0x34 , 0x37 },
	        new byte[] { 0x3A , 0x2A }, new byte[] { 0x36 , 0x37 }, new byte[] { 0x34 , 0x46 },
	        new byte[] { 0x20 , 0x2D }, new byte[] { 0x2E , 0x2A }, new byte[] { 0x2F , 0x2A },
	        new byte[] { 0x20 , 0x2A }, new byte[] { 0x24 , 0x2D }, new byte[] { 0x2A , 0x46 },
	        new byte[] { 0x2B , 0x46 }, new byte[] { 0x20 , 0x44 }, new byte[] { 0x35 , 0x2A },
	        new byte[] { 0x36 , 0x2A }, new byte[] { 0x2A , 0x35 }, new byte[] { 0x24 , 0x44 },
	        new byte[] { 0x25 , 0x44 }, new byte[] { 0x32 , 0x46 }, new byte[] { 0x2E , 0x35 },
	        new byte[] { 0x33 , 0x2D }, new byte[] { 0x30 , 0x2D }, new byte[] { 0x2A , 0x44 },
	        new byte[] { 0x2B , 0x44 }, new byte[] { 0x20 , 0x42 }, new byte[] { 0x2D , 0x44 },
	        new byte[] { 0x2E , 0x44 }, new byte[] { 0x2F , 0x44 }, new byte[] { 0x20 , 0x20 },
	        new byte[] { 0x25 , 0x42 }, new byte[] { 0x25 , 0x35 }, new byte[] { 0x2A , 0x4B },
	        new byte[] { 0x24 , 0x20 }, new byte[] { 0x25 , 0x20 }, new byte[] { 0x2A , 0x42 },
	        new byte[] { 0x2B , 0x42 }, new byte[] { 0x34 , 0x56 }, new byte[] { 0x20 , 0x35 },
	        new byte[] { 0x2A , 0x20 }, new byte[] { 0x2B , 0x20 }, new byte[] { 0x2B , 0x4B },
	        new byte[] { 0x24 , 0x35 }, new byte[] { 0x2E , 0x20 }, new byte[] { 0x2F , 0x20 },
	        new byte[] { 0x2B , 0x2D }, new byte[] { 0x31 , 0x20 }, new byte[] { 0x25 , 0x2D },
	        new byte[] { 0x2A , 0x2D }, new byte[] { 0x2F , 0x2D }, new byte[] { 0x35 , 0x20 },
	        new byte[] { 0x2A , 0x2A }, new byte[] { 0x2B , 0x2A }, new byte[] { 0x33 , 0x35 },
	        new byte[] { 0x20 , 0x4B }, new byte[] { 0x2D , 0x2D }, new byte[] { 0x32 , 0x35 },
	        new byte[] { 0x37 , 0x35 }, new byte[] { 0x24 , 0x4B }, new byte[] { 0x25 , 0x4B },
	        new byte[] { 0x36 , 0x35 }, new byte[] { 0x24 , 0x4A }, new byte[] { 0x20 , 0x2F },
	        new byte[] { 0x32 , 0x34 }, new byte[] { 0x33 , 0x34 }, new byte[] { 0x34 , 0x34 },
	        new byte[] { 0x24 , 0x2F }, new byte[] { 0x25 , 0x2F }, new byte[] { 0x37 , 0x34 },
	        new byte[] { 0x38 , 0x34 }, new byte[] { 0x2D , 0x4A }, new byte[] { 0x2E , 0x4A },
	        new byte[] { 0x2A , 0x2F }, new byte[] { 0x20 , 0x4A }, new byte[] { 0x31 , 0x52 },
	        new byte[] { 0x2D , 0x2F }, new byte[] { 0x2E , 0x2F }, new byte[] { 0x34 , 0x4A },
	        new byte[] { 0x20 , 0x39 }, new byte[] { 0x25 , 0x39 }, new byte[] { 0x32 , 0x2F },
	        new byte[] { 0x33 , 0x2F }, new byte[] { 0x24 , 0x39 }, new byte[] { 0x35 , 0x2F },
	        new byte[] { 0x36 , 0x2F }, new byte[] { 0x2B , 0x39 }, new byte[] { 0x38 , 0x2F },
	        new byte[] { 0x2D , 0x39 }, new byte[] { 0x2A , 0x39 }, new byte[] { 0x2F , 0x39 },
	        new byte[] { 0x31 , 0x4A }, new byte[] { 0x32 , 0x4A }, new byte[] { 0x2E , 0x39 },
	        new byte[] { 0x20 , 0x48 }, new byte[] { 0x25 , 0x32 }, new byte[] { 0x25 , 0x55 },
	        new byte[] { 0x3A , 0x55 }, new byte[] { 0x24 , 0x48 }, new byte[] { 0x25 , 0x48 },
	        new byte[] { 0x2A , 0x32 }, new byte[] { 0x2B , 0x32 }, new byte[] { 0x4C , 0x3A },
	        new byte[] { 0x20 , 0x55 }, new byte[] { 0x2A , 0x48 }, new byte[] { 0x2B , 0x48 },
	        new byte[] { 0x48 , 0x56 }, new byte[] { 0x24 , 0x55 }, new byte[] { 0x2E , 0x48 },
	        new byte[] { 0x2F , 0x48 }, new byte[] { 0x2B , 0x4D }, new byte[] { 0x20 , 0x37 },
	        new byte[] { 0x25 , 0x4D }, new byte[] { 0x2A , 0x4D }, new byte[] { 0x2F , 0x4D },
	        new byte[] { 0x24 , 0x37 }, new byte[] { 0x25 , 0x37 }, new byte[] { 0x2E , 0x4D },
	        new byte[] { 0x24 , 0x46 }, new byte[] { 0x25 , 0x46 }, new byte[] { 0x2D , 0x4D },
	        new byte[] { 0x2A , 0x37 }, new byte[] { 0x20 , 0x32 }, new byte[] { 0x34 , 0x55 },
	        new byte[] { 0x2D , 0x37 }, new byte[] { 0x2E , 0x37 }, new byte[] { 0x24 , 0x5A },
	        new byte[] { 0x20 , 0x31 }, new byte[] { 0x25 , 0x25 }, new byte[] { 0x2F , 0x36 },
	        new byte[] { 0x20 , 0x36 }, new byte[] { 0x24 , 0x31 }, new byte[] { 0x35 , 0x47 },
	        new byte[] { 0x36 , 0x47 }, new byte[] { 0x2B , 0x31 }, new byte[] { 0x20 , 0x25 },
	        new byte[] { 0x2D , 0x25 }, new byte[] { 0x2A , 0x31 }, new byte[] { 0x20 , 0x5A },
	        new byte[] { 0x24 , 0x25 }, new byte[] { 0x2A , 0x36 }, new byte[] { 0x2B , 0x36 },
	        new byte[] { 0x20 , 0x4C }, new byte[] { 0x2D , 0x2E }, new byte[] { 0x2E , 0x2E },
	        new byte[] { 0x2A , 0x25 }, new byte[] { 0x24 , 0x4C }, new byte[] { 0x25 , 0x4C },
	        new byte[] { 0x2A , 0x5A }, new byte[] { 0x2B , 0x5A }, new byte[] { 0x24 , 0x36 },
	        new byte[] { 0x20 , 0x43 }, new byte[] { 0x2A , 0x4C }, new byte[] { 0x2B , 0x4C },
	        new byte[] { 0x2B , 0x43 }, new byte[] { 0x24 , 0x43 }, new byte[] { 0x25 , 0x43 },
	        new byte[] { 0x2F , 0x4C }, new byte[] { 0x2F , 0x43 }, new byte[] { 0x20 , 0x41 },
	        new byte[] { 0x25 , 0x41 }, new byte[] { 0x2A , 0x43 }, new byte[] { 0x33 , 0x43 },
	        new byte[] { 0x24 , 0x41 }, new byte[] { 0x2D , 0x43 }, new byte[] { 0x2E , 0x43 },
	        new byte[] { 0x2B , 0x41 }, new byte[] { 0x30 , 0x43 }, new byte[] { 0x2D , 0x41 },
	        new byte[] { 0x2A , 0x41 }, new byte[] { 0x2F , 0x41 }, new byte[] { 0x34 , 0x43 },
	        new byte[] { 0x31 , 0x31 }, new byte[] { 0x2E , 0x41 }, new byte[] { 0x20 , 0x34 },
	        new byte[] { 0x20 , 0x57 }, new byte[] { 0x35 , 0x41 }, new byte[] { 0x3A , 0x43 },
	        new byte[] { 0x24 , 0x34 }, new byte[] { 0x24 , 0x57 }, new byte[] { 0x25 , 0x57 },
	        new byte[] { 0x2B , 0x4A }, new byte[] { 0x48 , 0x44 }, new byte[] { 0x38 , 0x41 },
	        new byte[] { 0x2A , 0x34 }, new byte[] { 0x2A , 0x57 }, new byte[] { 0x2B , 0x57 },
	        new byte[] { 0x2D , 0x34 }, new byte[] { 0x2D , 0x57 }, new byte[] { 0x2E , 0x57 },
	        new byte[] { 0x24 , 0x3A }, new byte[] { 0x25 , 0x3A }, new byte[] { 0x2E , 0x56 },
	        new byte[] { 0x2A , 0x33 }, new byte[] { 0x20 , 0x56 }, new byte[] { 0x44 , 0x41 },
	        new byte[] { 0x2D , 0x33 }, new byte[] { 0x2E , 0x33 }, new byte[] { 0x37 , 0x2B },
	        new byte[] { 0x2D , 0x3A }, new byte[] { 0x2E , 0x3A }, new byte[] { 0x2F , 0x3A },
	        new byte[] { 0x20 , 0x3A }, new byte[] { 0x34 , 0x2B }, new byte[] { 0x2A , 0x56 },
	        new byte[] { 0x2B , 0x56 }, new byte[] { 0x20 , 0x24 }, new byte[] { 0x20 , 0x49 },
	        new byte[] { 0x25 , 0x49 }, new byte[] { 0x2F , 0x4E }, new byte[] { 0x24 , 0x24 },
	        new byte[] { 0x24 , 0x49 }, new byte[] { 0x2A , 0x3A }, new byte[] { 0x2B , 0x3A },
	        new byte[] { 0x24 , 0x56 }, new byte[] { 0x20 , 0x33 }, new byte[] { 0x2A , 0x24 },
	        new byte[] { 0x2A , 0x49 }, new byte[] { 0x2B , 0x33 }, new byte[] { 0x24 , 0x33 },
	        new byte[] { 0x25 , 0x33 }, new byte[] { 0x2E , 0x49 }, new byte[] { 0x20 , 0x38 },
	        new byte[] { 0x30 , 0x49 }, new byte[] { 0x35 , 0x49 }, new byte[] { 0x2A , 0x2B },
	        new byte[] { 0x20 , 0x2E }, new byte[] { 0x25 , 0x38 }, new byte[] { 0x2D , 0x2B },
	        new byte[] { 0x2E , 0x2B }, new byte[] { 0x24 , 0x2E }, new byte[] { 0x25 , 0x2E },
	        new byte[] { 0x2A , 0x38 }, new byte[] { 0x2B , 0x38 }, new byte[] { 0x2B , 0x2B },
	        new byte[] { 0x2D , 0x38 }, new byte[] { 0x2A , 0x2E }, new byte[] { 0x2B , 0x2E },
	        new byte[] { 0x2F , 0x47 }, new byte[] { 0x20 , 0x47 }, new byte[] { 0x32 , 0x38 },
	        new byte[] { 0x3A , 0x2B }, new byte[] { 0x30 , 0x2E }, new byte[] { 0x24 , 0x47 },
	        new byte[] { 0x25 , 0x47 }, new byte[] { 0x33 , 0x2E }, new byte[] { 0x34 , 0x2E },
	        new byte[] { 0x20 , 0x2B }, new byte[] { 0x3A , 0x38 }, new byte[] { 0x2A , 0x47 },
	        new byte[] { 0x2B , 0x47 }, new byte[] { 0x24 , 0x2B }, new byte[] { 0x25 , 0x2B },
	        new byte[] { 0x2E , 0x47 }
        };
        #endregion
        
        private static byte GetLowNibble(byte b1, byte b0)
        {
            var lineIndex = b0 % 8;
            var parity = b1 % 2;
            var startVal = parity;
            switch (lineIndex % 4)
            {
                case 1:
                    startVal += parity == 0 ? (lineIndex * 2) ^ 3 : 0xD;
                    break;
                case 2:
                    startVal += lineIndex * 2 + 8;
                    break;
                case 3:
                    startVal += lineIndex * 2 + 3;
                    break;
            }
            var multiplier = ((lineIndex != 3 && lineIndex != 5) || (parity == 0)) ? 1 : 5;
            return (byte)((startVal + (b1 - parity) * multiplier) % 0x10);
        }

        private static byte GetHighNibble(byte b1, byte b0)
        {
            var length = HighNibbleTable[b0 & 0x7F].Length;
            var index = b1 % length;
            return (byte)((HighNibbleTable[b0 & 0x7F][index] << 4) + b1 - index);
        }

        private static byte DecryptByte(byte b0, byte b1)
        {
            return (byte)(GetHighNibble(b0, b1) + GetLowNibble(b0, b1));
        }

        public static byte[] Decrypt(byte[] input)
        {
            if (input.Length % 2 != 0)
                return null;
            var buffer = new byte[input.Length / 2];
            for (var i = 0; i < buffer.Length; i++)
                buffer[i] = DecryptByte(input[i * 2], input[i * 2 + 1]);
            return buffer;
        }

        //Using AlphaNumeric characters to reduce QR Code size (5.5 bits per character)
        public static byte[] Encrypt(byte[] input)
        {
            if (input == null)
                return null;
            var buffer = new byte[input.Length * 2];
            for (var i = 0; i < input.Length; i++)
                Buffer.BlockCopy(Alphanumerics[input[i]], 0, buffer, i*2, 2);
            return buffer;
        }

        /*
        private static readonly List<byte[]>[] AlphaNumericTable = new List<byte[]>[256];
        private static readonly byte[] AlphaNumericBytes = new byte[] {
            //      $   %   *   +   -   .   /   :        
            0x20, 0x24, 0x25, 0x2A, 0x2B, 0x2D, 0x2E, 0x2F, 0x3A,
            //  0   1   2   3   4   5   6   7   8   9        
            0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 
            //  A   B   C   D   E   F   G   H   I   J
            0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 
            //  K   L   M   N   O   P   Q   R   S   T
            0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 
            //  U   V   W   X   Y   Z
            0x55, 0x56, 0x57, 0x58, 0x59, 0x5A
        };
        
        static Crypt()
        {
            for (var i = 0; i < 256; i++)
                AlphaNumericTable[i] = new List<byte[]>();
            foreach (var letterA in AlphaNumericBytes)
            {
                foreach (var letterB in AlphaNumericBytes)
                {
                    var output = DecryptByte(letterA, letterB);
                    AlphaNumericTable[output].Add(new[] { letterA, letterB });
                }
            }

        }
        
        public static void SaveAlphaFile(string filename)
        {
            var fs = System.IO.File.OpenWrite(filename);
            var sw = new System.IO.StreamWriter(fs);
            for (var i = 0; i < 256; i++)
            {
                for (var j = 0; j < AlphaNumericTable[i].Count; j++)
                    sw.Write(string.Format("{0}{1}|", (char)AlphaNumericTable[i][j][0], (char)AlphaNumericTable[i][j][1]));
                sw.WriteLine();
            }
            sw.Close();
            fs.Close();

        }

        public static void SaveArrayFile(string filename)
        {
            var fs = System.IO.File.OpenWrite(filename);
            var sw = new System.IO.StreamWriter(fs);
            sw.WriteLine("private static readonly byte[][] Alphanumerics = new byte[][] {");
            for (var i = 0; i < 255; i += 3)
            {
                sw.WriteLine(string.Format("\tnew byte[] {{ 0x{0} , 0x{1} }}, new byte[] {{ 0x{2} , 0x{3} }}, new byte[] {{ 0x{4} , 0x{5} }},", 
                    AlphaNumericTable[i][0][0].ToString("X2"), AlphaNumericTable[i][0][1].ToString("X2"),
                    AlphaNumericTable[i+1][0][0].ToString("X2"), AlphaNumericTable[i+1][0][1].ToString("X2"),
                    AlphaNumericTable[i+2][0][0].ToString("X2"), AlphaNumericTable[i+2][0][1].ToString("X2")));
            }
            sw.WriteLine(string.Format("\tnew byte[] {{ 0x{0} , 0x{1} }}", AlphaNumericTable[255][0][0].ToString("X2"), AlphaNumericTable[255][0][1].ToString("X2")));
            sw.WriteLine("};");
            sw.Close();
            fs.Close();
        }*/
    }
}
